<?php
class NewsModel extends Model {

    protected $_validate = array(
        array('title', '5,100', '新闻标题必须是5~100位!', 1, 'length'),
        array('content', 'require', '新闻内容必须填写!')
    );

    protected $_auto = array(
        array('addtime', 'time', 1, 'function'),
        array('attr', 'createAttr', 3, 'callback')
    );

    public function createAttr() {
        if($_POST['attr'] != '') {
            return implode(',', $_POST['attr']);
        } else {
            return '';
        }
    }


}

?>